<%--
  Created by IntelliJ IDEA.
  User: meng
  Date: 2020/5/11
  Time: 12:02
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<% String path = request.getContextPath();%>
<!doctype html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>简历</title>
    <link href="http://cdn.bootcss.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet">

    <!-- INCLUDES -->
    <link rel="stylesheet" href="<%=path%>/static/css/web/bootstrap-table-expandable.css">
    <link rel="stylesheet" type="text/css" href="<%=path%>/static/css/web/base.css">
    <style>
        table.table-expandable > tbody > tr div.table-expandable-arrow {
            background:transparent url("<%=path%>/static/images/web/arrows.png") no-repeat scroll 0px -16px;
            width:16px; height:16px; display:block;
            margin-top: 40px;
            margin-left: -50px;
        }
        table tbody tr{height: 100px;}
        table li {list-style: none;}
        .schoolId{margin-right: 100px;}
        .startTime{margin-right: 100px;}
        .professionalName{margin-right: 100px;}
        .eduTypeId{margin-right: 10px;}
        table thead tr th{font-size: 20px;font-weight: 700;}
        table tbody b{color: #20c997;}
        table tbody h5{color: #ff6600;margin-bottom: 10px;}

    </style>

</head>



<body class="mkeBody">
<%--<div class="mkeHeadBox">个人简历</div>--%>
<div class="mkeContentBox">
    <div class="container">
        <div class="row">
            <div class="col-md-9" id="pagecontent">

    <table class="table table-hover table-expandable">
        <thead>
        <tr>
            <th colspan="4">个人简历</th>
        </tr>
        <tr>
            <td colspan="6">
                ${sessionScope.person.name}&nbsp;
                <c:if test="${sessionScope.person.sex eq '男'}">
                    <img src="<%=path%>/static/images/web/man.png" style="width: 20px">
                </c:if>
                <c:if test="${sessionScope.person.sex eq '女'}">
                    <img src="<%=path%>/static/images/web/woman.png" style="width: 20px">
                </c:if>
                <span id="age"></span>
                <br><br>手机号:${sessionScope.person.phone}
            </td>
            <th>
                <c:if test="${sessionScope.person.pic==0}">
                    <img src="<%=path%>/static/images/web/uploadimages/0.jpeg" id="relTouXiang" style="width: 40px"/>
                </c:if>
                <c:if test="${sessionScope.person.pic!=0}">
                    <img src="<%=path%>/static/images/web/uploadimages/${sessionScope.person.pic}" id="relTouXiang" style="width: 40px"/>
                </c:if>
            </th>
        </tr>
        </thead>
        <tbody>

        <tr>
            <td colspan="6"><c:if test="${requestScope.advantages!=null}">
                    <b>个人优势</b>
                    <br><br>
                    <span id="advantage">${requestScope.advantages}</span>

            </td>
            <td></c:if>
            </td>
        </tr>

        <c:if test="${requestScope.educationalExperience!=''}">
            <tr>
                <td colspan="6" id="xxxx"><%--educationalExperience--%>
                    <b>教育经历</b>
                    <br><br>
                    <c:if test="${requestScope.educationalExperience!=null}">
                        <c:forEach items="${requestScope.educationalExperience}" varStatus="x" var="eduExp">
                    <span>
                    ${x.count}.
                    <span class="schoolId">${eduExp.school.schoolName}</span>
                    <span class="startTime">
                        <fmt:formatDate value="${eduExp.startTime}"></fmt:formatDate>-
                        <fmt:formatDate value="${eduExp.graduationTime}"></fmt:formatDate>
                    </span>
                    <span class="professionalName">${eduExp.professionalName}</span>
                    <span class="eduTypeId">${eduExp.educationalBackgroundType.educationalBackgroundTypeName}</span>

                    <br><br>
                    </span>
                        </c:forEach>
                    </c:if>
                </td>
                <td></td>
            </tr></c:if>

        <c:if test="${requestScope.education ne ''}">
        <tr>
            <td colspan="6">

                <b>学历</b>
                <br><br>
            <c:if test="${requestScope.education ne '无'}">
                <span id="education">
                    ${requestScope.education}
                </span>
            </c:if>
            </td>
            <td>
        </tr></c:if>

        <c:if test="${requestScope.positionDesired!=null}">
            <tr>
                <td colspan="6">
                    <b>期望职位</b>
                    <br><br>
                    <span id="position">
                    <c:if test="${requestScope.positionDesired!=null}">
                        <span id="positionTypeId" style="margin-right: 50px">${requestScope.positionDesired.positionType.positionTypeName}</span>
                        <span id="positionId" style="margin-right: 50px">${requestScope.positionDesired.position.positionName}</span>
                        <span id="salaryMin" style="margin-right: 2px">${requestScope.positionDesired.salaryMin}K</span>-
                        <span id="salaryMax" style="margin-right: 50px">${requestScope.positionDesired.salaryMax}K</span>
                        <span id="industryId" style="margin-right: 50px">${requestScope.positionDesired.industry.industryName}</span>
                        <span id="cityId" style="margin-right: 50px">${requestScope.positionDesired.city.cityName}</span>
                    </c:if>
                </span>
                </td>
                <td>
                </td>
            </tr></c:if>

        <c:if test="${requestScope.projectExp!=''}">
        <tr>
            <td colspan="6">
                    <b>项目经历</b>
                    <br><br>
                    <c:forEach items="${requestScope.projectExp}" varStatus="x" var="proExp">
                    <span>
                    项目${x.count}.
                    项目名称：<span class="proExpName" style="margin-right: 50px">${proExp.name}</span>
                    角色：<span class="proExpRole" style="margin-right: 50px">${proExp.role}</span>
                    网址：<span class="proExpUrl" style="margin-right: 50px">${proExp.url}</span>
                    项目起止时间：<span class="startAndEndTime">
                        <fmt:formatDate value="${proExp.startTime}"></fmt:formatDate>-
                        <fmt:formatDate value="${proExp.endTime}"></fmt:formatDate>
                        </span><br>

                    项目描述：<span class="proExpDescribe">${proExp.describe}</span><br>
                    业绩：<span class="proExpAchievement">${proExp.achievement}</span>

                    <br><hr><br>
                    </span>
                    </c:forEach>
            </td>
            <td>

            </td>
        </tr></c:if>

        <c:if test="${requestScope.workExp!=''}">
            <tr>
                <td colspan="6">
                    <b>工作经历</b>
                    <br><br>
                    <c:if test="${requestScope.workExp!=null}">
                        <c:forEach items="${requestScope.workExp}" varStatus="x" var="workExp">
                    <span>
                        工作${x.count}<%--是否是实习--%>
                        <c:if test="${workExp.isPractice==true}">
                            (实习)
                        </c:if><br><br>
                        公司名称:<span class="companyName" style="margin-right: 50px">${workExp.companyName}</span>
                        行业:<span class="industryId" style="margin-right: 50px">${workExp.industry.industryName}</span><br><br>
                        所属部门:<span class="department" style="margin-right: 50px">${workExp.department}</span>
                        职位名称:<span class="positionId" style="margin-right: 50px">${workExp.position.positionName}</span>
                        职位类型:<span class="positionTypeId" style="margin-right: 50px">${workExp.positionType.positionTypeName}</span>
                        工作时间:<span class="workTime" style="margin-right: 0px">${workExp.workTime}</span>年
                       <br><br>
                        工作内容:<span class="workContent" style="margin-left: 50px;">${workExp.workContent}</span><br><br>
                        工作业绩:<span class="workAchievement" style="margin-right: 50px">${workExp.workAchievement}</span><br>
                        <hr><br>
                    </span>
                        </c:forEach>
                    </c:if>
                </td><td></td>
            </tr></c:if>

        <c:if test="${requestScope.skillLabelInfo!=''}">
        <tr>
            <td colspan="6">

                    <b>技能标签</b>
                    <br><br>
                    <c:forEach items="${requestScope.skillLabelInfo}" varStatus="x" var="skillLabel">
                        <span>
                        <span class="skillLabelId">${skillLabel.skillLabelId}</span>
                            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                        </span>
                    </c:forEach>


            </td><td></td>
        </tr></c:if>

        <c:if test="${requestScope.credentials!=null}">
        <tr>
            <td colspan="6">

                <b>资格证书</b>
                <br><br>
                    <span id="credential">${requestScope.credentials}</span>

            </td>
            <td>

            </td>
        </tr></c:if>
        </tbody>
    </table>

            </div>
            <div class="col-md-3">
                <a class="btn btn-default jquery-word-export" href="javascript:void(0)" style="color: aqua">
                    <span class="word-icon">简历</span>
                    导出为.doc文档
                </a>
            </div>
        </div>
    </div>
</div>

</body>
<script type="text/javascript" src="<%=path%>/static/js/jquery-3.4.1.min.js"></script>

<script src="http://www.jq22.com/jquery/jquery-1.10.2.js"></script>
<script type="text/javascript" src="<%=path%>/static/js/web/FileSaver.js"></script>
<script type="text/javascript" src="<%=path%>/static/js/web/jquery.wordexport.js"></script>

<script type="text/javascript">
    var path="${pageContext.servletContext.contextPath}";
    var birth="<fmt:formatDate value="${sessionScope.person.birth}"></fmt:formatDate>";
    $(function () {
        //alert(${requestScope.skillLabelInfo})
        $("a.jquery-word-export").click(function(event) {
            $("#pagecontent").wordExport();
        });

        var age=jsGetAge(birth);
        $("#age").html(age);
        /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
        //获取学校类型值
        $(".schoolId").each(function () {
            var id=$(this).html();
            //alert($(this).html());
            $.get(path+"/web/person/getSchoolName",{id:id}, function (schoolName) {
                $(this).html(schoolName);
            }.bind(this))
        });
        /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
        //获取学历类型值
        $(".eduTypeId").each(function () {
            var id=$(this).html();
            //alert($(this).html());
            $.get(path+"/web/person/getEduTypeName",{id:id}, function (eduTypeName) {
                $(this).html(eduTypeName);
            }.bind(this))
        });
        /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/

        //获取行业
        $(".industryId").each(function () {
            var id=$(this).html();
            //alert($(this).html());
            $.get(path+"/web/person/getIndustryName",{industryId:id}, function (data) {
                $(this).html(data);
            }.bind(this))
        });
        //获取职位类型名称
        $(".positionTypeId").each(function () {
            var id=$(this).html();
            //alert($(this).html());
            $.get(path+"/web/person/getPositionTypeName",{positionTypeId:id}, function (data) {
                $(this).html(data);
            }.bind(this))
        });
        //获取职位名称
        $(".positionId").each(function () {
            var id=$(this).html();
            //alert($(this).html());
            $.get(path+"/web/person/getPositionName",{positionId:id}, function (data) {
                $(this).html(data);
            }.bind(this))
        });
        //获取技能标签
        $(".skillLabelId").each(function () {
            var id=$(this).html();
            //alert($(this).html());
            $.get(path+"/web/person/getSkillLabelName",{skillLabelId:id}, function (data) {
                $(this).html(data);
            }.bind(this))
        });
        /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
        /*+++++++++++++++++++++++++++++++++++++++++++++++期望职位++++++++++*/

        //获取职位类型值
        var positionTypeId=$("#positionTypeId").text();
        //alert(id);
        $.get(path+"/web/person/getPositionTypeName",{positionTypeId:positionTypeId}, function (data) {
            $("#positionTypeId").html(data);
        });

        //获取职位名称
        var positionId=$("#positionId").text();
        //alert(id);
        $.get(path+"/web/person/getPositionName",{positionId:positionId}, function (data) {
            $("#positionId").html(data);
        });

        //获取行业值
        var industryId=$("#industryId").text();
        //alert(id);
        $.get(path+"/web/person/getIndustryName",{industryId:industryId}, function (data) {
            $("#industryId").html(data);
        });

        //获取城市
        var cityId=$("#cityId").text();
        //alert(id);
        $.get(path+"/web/person/getCityName",{cityId:cityId}, function (data) {
            $("#cityId").html(data);
        });
        /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
    });
    /*根据出生日期算出年龄*/
    function jsGetAge(strBirthday){
        var returnAge;
        var strBirthdayArr=strBirthday.split("-");
        var birthYear = strBirthdayArr[0];
        var birthMonth = strBirthdayArr[1];
        var birthDay = strBirthdayArr[2];

        d = new Date();
        var nowYear = d.getFullYear();
        var nowMonth = d.getMonth() + 1;
        var nowDay = d.getDate();

        if(nowYear == birthYear){
            returnAge = 0;//同年 则为0岁  
        }
        else{
            var ageDiff = nowYear - birthYear ; //年之差  
            if(ageDiff > 0){
                if(nowMonth == birthMonth) {
                    var dayDiff = nowDay - birthDay;//日之差  
                    if(dayDiff < 0)
                    {
                        returnAge = ageDiff - 1;
                    }
                    else
                    {
                        returnAge = ageDiff ;
                    }
                }
                else
                {
                    var monthDiff = nowMonth - birthMonth;//月之差  
                    if(monthDiff < 0)
                    {
                        returnAge = ageDiff - 1;
                    }
                    else
                    {
                        returnAge = ageDiff ;
                    }
                }
            }
            else
            {
                returnAge = -1;//返回-1 表示出生日期输入错误 晚于今天  
            }
        }
        return returnAge;//返回周岁年龄  
    }
</script>

</html>
